package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppDataBackupLog;
import com.ep.modules.app.service.AppDataBackupLogService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/data_backup_log")
public class AppDataBackupLogController {
    @Autowired
    private AppDataBackupLogService appDataBackupLogService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appDataBackupLogService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppDataBackupLog appdatabackuplog = appDataBackupLogService.getById(id);
        return R.ok().put("appdatabackuplog", appdatabackuplog);
    }

    @SysLog("保存AppDataBackupLog")
    @PostMapping("/save")
    public R save(@RequestBody AppDataBackupLog appdatabackuplog) {
        ValidatorUtils.validateEntity(appdatabackuplog);
        appDataBackupLogService.save(appdatabackuplog);
        return R.ok();
    }

    @SysLog("修改AppDataBackupLog")
    @PostMapping("/update")
    public R update(@RequestBody AppDataBackupLog appdatabackuplog) {
        ValidatorUtils.validateEntity(appdatabackuplog);
        appDataBackupLogService.update(appdatabackuplog);
        return R.ok();
    }

    @SysLog("删除AppDataBackupLog")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appDataBackupLogService.deleteBatch(ids);
        return R.ok();
    }
}